import heapq


class SeatManager:

    def __init__(self, n: int):
        self.lst = [i + 1 for i in range(n)]
        self.unseat = set()

    def reserve(self) -> int:
        return heapq.heappop(self.lst)

    def unreserve(self, seatNumber: int) -> None:
        heapq.heappush(self.lst, seatNumber)


if __name__ == "__main__":
    obj = SeatManager(5)
    print(obj.reserve())  # 1
    print(obj.reserve())  # 2
    obj.unreserve(2)
    print(obj.reserve())  # 2
    print(obj.reserve())  # 3
    print(obj.reserve())  # 4
    print(obj.reserve())  # 5
